package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 健康情况分析
 * 
 * @author ytche
 * @date 2017年4月21日
 * 
 */
@Entity
@Table(name = "health_analysis")
@JsonApiResource(type = "healthAnalysis")
public class HealthAnalysis extends BaseEntity {

	private static final long serialVersionUID = 1L;
	private Customer customer;
	private Integer createTime;
	private String contents;
	private String mulContents;
	private Dicttype type;

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "contents")
	public String getContents() {
		return contents;
	}

	public void setContents(String contents) {
		this.contents = contents;
	}

	@Column(name = "mul_contents")
	public String getMulContents() {
		return mulContents;
	}

	public void setMulContents(String mulContents) {
		this.mulContents = mulContents;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "type_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getType() {
		return type;
	}

	public void setType(Dicttype type) {
		this.type = type;
	}

}
